﻿namespace Bowlus.FrontEnd.RequestRouting.ApplicationDeployment
{

    using Bowlus.Common;

    public abstract class ApplicationDeploymentRequest
    {
        protected ApplicationDeploymentRequest(TenantDeployment tenantDeployment)
        {
            this.TenantDeployment = tenantDeployment;
        }

        public TenantDeployment TenantDeployment { get; private set; }

        protected abstract string RequestType { get; }

        public virtual void MakeDeploymentRequest()
        {
            if (this.RequestType.Equals(string.Empty))
            {
                return;
            }

            this.TenantDeployment.Status = TenantDeploymentStatus.DeployRequestSubmitted;
            this.TenantDeployment.DeploymentAction = this.RequestType;

            TenantDeploymentsStore.UpdateDeploymentStore(this.TenantDeployment);
        }
    }
}
